package com.darren.archive.entity;

import com.alibaba.fastjson.annotation.JSONField;
import com.darren.framework.entity.BaseEntity;
import com.darren.framework.utils.Constant;
import org.hibernate.annotations.ResultCheckStyle;
import org.hibernate.annotations.SQLDelete;
import org.hibernate.annotations.Where;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.PostRemove;
import javax.persistence.Table;
import java.io.Serializable;
import java.util.Date;


@Entity
@Table(name = Constant.TABLE_NAME_PREV + "system_parameter")
@SQLDelete(sql = "update " + Constant.TABLE_NAME_PREV + "system_parameter set is_delete = true where id=?", check = ResultCheckStyle.COUNT)
@Where(clause = "is_delete  = false")
public class SysParameter extends BaseEntity implements Serializable {

    private static final long serialVersionUID = 4370220438523741406L;

    @Column(name = "lookup_cat", columnDefinition = "varchar(80) default '' comment '配置分类名'")
    private String lookupCat;

    @Column(name = "lookup_type", columnDefinition = "varchar(80) default '' comment '参数名'")
    private String lookupType;

    @Column(name = "lookup_value", columnDefinition = "varchar(250) default '' comment '参数值'")
    private String lookupValue;

    @Column(name = "comment", columnDefinition = "varchar(250) default '' comment '参数描述'")
    private String comment;

    @JSONField(name = "createDate", format = "yyyy-MM-dd HH:mm:ss")
    @Column(name = "effective_date", columnDefinition = "datetime default CURRENT_TIMESTAMP comment '参数生效时间'")
    private Date effDate;

    @JSONField(name = "terminatedDate", format = "yyyy-MM-dd HH:mm:ss", serialize = false)
    @Column(name = "terminated_Date", columnDefinition = "datetime default null comment '参数失效时间'")
    private Date termDate;

    public String getLookupCat() {
        return lookupCat;
    }

    public void setLookupCat(String lookupCat) {
        this.lookupCat = lookupCat;
    }

    public String getLookupType() {
        return lookupType;
    }

    public void setLookupType(String lookupType) {
        this.lookupType = lookupType;
    }

    public String getLookupValue() {
        return lookupValue;
    }

    public void setLookupValue(String lookupValue) {
        this.lookupValue = lookupValue;
    }

    public String getComment() {
        return comment;
    }

    public void setComment(String comment) {
        this.comment = comment;
    }

    public Date getEffDate() {
        return effDate;
    }

    public void setEffDate(Date effDate) {
        this.effDate = effDate;
    }

    public Date getTermDate() {
        return termDate;
    }

    public void setTermDate(Date termDate) {
        this.termDate = termDate;
    }

}
